<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>执行时间</title>
<script type="text/javascript">
var t1,t2,htime,sum=0;
t1=new Date();
document.write("循环前的时间是："
+t1.toLocaleString()+":"+t1.getMilliseconds()+"<br/>");
for(var i=1;i<=10000;i++){
	sum+=i;
}
t2=new Date();
document.write("循环后的时间是："
+t2.toLocaleString()+":"+t2.getMilliseconds()+"<br/>");
htime=t2.getTime()-t1.getTime();
document.write("执行10000次循环用时："+htime+"毫秒");
</script>

</head>

<body>
</body>
</html>
